const toast = Swal.mixin({
  toast: true,
  position: 'top-end',
  showConfirmButton: false,
  timer: 3000,
  timerProgressBar: true,
  didOpen: (toast) => {
    toast.addEventListener('mouseenter', Swal.stopTimer)
    toast.addEventListener('mouseleave', Swal.resumeTimer)
  }
})

Toast = {
  success: (message) => {
    toast.fire({
      icon: 'success',
      title: message
    })
  },

  error: (message) => {
    toast.fire({
      icon: 'error',
      title: message
    })
  },

  warning: (message) => {
    toast.fire({
      icon: 'warning',
      title: message
    })
  },
}